package com.example.freshfoodproject.service.impl;

import com.example.freshfoodproject.entry.Goods;
import com.example.freshfoodproject.mapper.ListMapper;
import com.example.freshfoodproject.service.ListService;
import com.example.freshfoodproject.util.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ListServiceImpl implements ListService {
    @Autowired
    private ListMapper listMapper;
    @Override
    public List<Goods> findType() {
        return listMapper.selectType();
    }

    @Override
    public List<Goods> findAll() {
        return listMapper.selectAll();
    }

    @Override
    public Goods findName(String goodsName) {
        return listMapper.selectName(goodsName);
    }

    @Override
    public List<Goods> findGoodsByQueryAndIndex(Goods goods, PageHelper pageHelper) {
        return listMapper.selectGoodsByQueryAndIndex(goods,pageHelper);
    }

    @Override
    public List<Goods> findGoodsByQueryAndIndexSort(Goods goods, PageHelper pageHelper) {
        return listMapper.selectGoodsByQueryAndIndexSort(goods,pageHelper);
    }

    @Override
    public List<Goods> findGoodsByQueryAndIndexTotal(Goods goods, PageHelper pageHelper) {
        return listMapper.selectGoodsByQueryAndIndexTotal(goods,pageHelper);
    }

    @Override
    public int changeTotal(Goods goods) {
        return listMapper.updateTotal(goods);
    }

    @Override
    public int chageRecentlyViewed(Goods goods) {
        return listMapper.updateRecentlyViewed(goods);
    }
}
